home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / May 96 / Re ODF R1 RefCounting Extensio < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  2.2 KB  |  [TEXT/ttxt]

  1. Subject:     Re: ODF R1 RefCounting Extensio
  2. Sent:        5/30/96 5:00 PM
  3. Received:    5/30/96 5:21 PM
  4. From:        Henri Lamiraux, lamiraux@apple.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. >In ODF R1, calling FW_CExtensionManager::AcquireExtension() for our extension
  9. >never Acquire()'s the extension if it has to create it, so the refcount
  10. >remains 0, and a subsequent Release() leads to a warning from OpenDoc.  For a
  11. >cached part such as ours, subsequent uses of the extension don't have a
  12. >problem because FW_CExtensionManager::AcquireExtension() does Acquire() the
  13. >extension if it is only retrieving it from the cache.
  14. >
  15. >I suspect that the line:
  16. >
  17. >    acquiredExtension->Acquire(ev);
  18. >
  19. >should be inserted into the following code in
  20. >FW_CExtensionManager::AcquireExtension:
  21. >
  22. >    if (pair->fValue.fCreateFunction)
  23. >                {
  24. >        acquiredExtension = (pair->fValue.fCreateFunction)
  25. >                                (ev, fPart, name, pair->fValue.fRefCon);
  26. >        acquiredExtension->Acquire(ev);  // New line to increment refcount
  27. >                       pair->fValue.fExtension = acquiredExtension;
  28. >                }
  29. >
  30. >Alternatively, the extension's CreateFunction could Acquire() the extension,
  31. >but the documentation does not indicate this and it seems inappropriate to
  32. >me.  One might want to create the extension before there are any clients (for
  33. >caching purposes, for instance).
  34. >
  35. >Is this a bug in FW_CExtensionManager::AcquireExtension, or have I missed
  36. >something?
  37. >
  38. >Kirk Swenson
  39. >Senior Software Engineer
  40. >Key Curriculum Press
  41. >kswenson@keypress.com
  42. >
  43.  
  44. Greg Friedman should be answering this question but I though that 
  45. refcounted objects in OpenDoc were created with a refcount of 1? When you 
  46. create an ODShape (subclass of ODRefcounted object) it's refcount is 1. I 
  47. am just wondering why your refcount is 0. A refcount of zero means the 
  48. object is gone.
  49.  
  50. .......................................................................
  51.  Henri Lamiraux                                      lamiraux@apple.com
  52.  Apple Computer, Inc.                 OpenDoc(tm) Development Framework
  53. .......................................................................
  54.  
  55.